import 'whatwg-fetch';
// export const base = 'http://123.56.31.168:39123';
// export const base = 'http://172.104.116.120:39888';
export const base = 'http://47.52.162.216:8881'; //出租盘服务器
// export const base = 'http://47.89.11.109:39888'; //OEM 威尼斯
// export const base = 'http://39.104.63.125:39888';  //测试服务器
// export const base = 'http://39.104.63.125:39889';  //现金盘

// export const base = '//'+window.location.host;

var urlEncode = function (param, key, encode) {
    if(param==null) return '';
    var paramStr = '';
    var t = typeof (param);
    if (t == 'string' || t == 'number' || t == 'boolean') {  
      paramStr += '&' + key + '=' + ((encode==null||encode) ? encodeURIComponent(param) : param);  
    } else {  
      for (var i in param) {
        var k = key == null ? i : key + (param instanceof Array ? '[' + i + ']' : '.' + i);  
        paramStr += urlEncode(param[i], k, encode);
      }
    }
    return paramStr;  
  };

function UnicodeToUtf8(unicode) {
    var uchar;
    var utf8str = "";  
    var i;
    for(i=0; i<unicode.length;i+=2){           
        uchar = (unicode[i]<<8) | unicode[i+1];               //UNICODE为2字节编码，一次读入2个字节  
        utf8str = utf8str  + String.fromCharCode(uchar);    //使用String.fromCharCode强制转换
    }
    return utf8str;  
}

export const  repeater = (vm,n,d)=>{
    vm.$Loading.start();
    const promist = new Promise(function(resolve,reject){
        vm.$api[n](d).then(response=>{
            vm.$Loading.finish();
            response.json().then(responseJson=> {
                resolve(responseJson)
            })
            if(response.status!==200){
                vm.$Loading.error();
            }
            if(response.status==401){
                vm.$Modal.error({
                    title: '警告',
                    okText: '返回登录页面',
                    content: '登录信息已失效，请重新登录',
                    onOk: () => {
                        sessionStorage.clear()
                        vm.$router.push({
                            name: 'login'
                        });
                    }
                });
            }
            if(response.status==500){
                response.text().then(responseJson=> {
                    var regex = /<pre.*?>(.*?)<\/pre>/ig; 
                    var result = regex.exec(responseJson);
                    vm.$Notice.error({
                        title: '错误',
                        desc: result[1]
                    });
                    resolve(false)
                })
            }
            if(response.status==503){
                let photo=response.headers.get('License-Warning')
                if(photo!==null){
                    let testStr=unescape(photo.replace(/\\u/g, '%u'))
                    let reg = /^["|'](.*)["|']$/g;
                    let test=testStr.replace(reg,"$1");
                    let id = 0
                    if(test=='未授权的软件副本')id = 1
                    if(test=='软件试用期已满')id = 2
                    if(test=='软件授权有效期已满')id = 3
                    vm.$router.push({name: 'error-503',params:{id:id}})
                }
            }
            if(response.status==200){
                
            }
        }).catch(error => {
            if(error=='TypeError: Failed to fetch'){
                vm.$Message.error('服务器无法连接');
            }
            vm.$Loading.error();
        });
    })
    return promist;
}



const headers={
    'Accept':'application/json',
    'Content-Type': 'application/json',
    'Access-Control-Allow-Origin':'*'
}

/**
 * 验证码
 * @param params params
 * 
 */
export const getCaptcha = params => fetch(`${base}/v1/captcha`, {
    method: 'GET', 
    // credentials: '*', 
    body: params
});

/**
 * 验证码
 * @param params params
 */
export const setCaptcha = params => fetch(`${base}/v1/captcha?key=${params}`, {
    method: 'PUT', 
    // credentials: '*', 
    body: params
});

/**
 * 重启服务
 * @param params params
 */
export const reboot = params => fetch(`${base}/v1/reboot`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
});

/**
 * 清除缓存
 * @param params params
 */
export const clearCache = params => fetch(`${base}/v1/clear_cache`, {
    method: 'GET',
    // credentials: '*',
    // body: params,
});

/**
 * 登陆
 * @param params params
 */
export const login = params => fetch(`${base}/v1/login`, {
    method: 'POST', 
    // credentials: '*', 
    body: JSON.stringify(params)
});

/**
 * 获取用户组
 * @param params params
 */
export const getGroup = params => fetch(`${base}/v1/banker/group`, {
    method: 'GET',
    // credentials: '*',
    body: params,
    headers: {
        Authorization:sessionStorage.token
    }
});

/**
 * 获取用户
 * @param params params
 */
export const getUsers = params => fetch(`${base}/v1/banker/records/users?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    // credentials: '*',
    // body: params,
    headers: {
        Authorization:sessionStorage.token
    }
});

/**
 * 修改用户
 * @param params params
 */
export const setUsers = params => fetch(`${base}/v1/banker/records/users?${urlEncode(params.query).substr(1)}`, {
    method: 'PUT',
    // credentials: '*',
    body: JSON.stringify(params.data),
    headers: {
        Authorization:sessionStorage.token
    }
});

/**
 * 修改登录密码
 * @param params params
 */
export const resetLoginPwd = params => fetch(`${base}/v1/open/reset_login_pwd`, {
    method: 'PATCH',
    // credentials: '*',
    body: JSON.stringify(params),
    headers: {
        Authorization:sessionStorage.token
    }
});

/**
 * 重置密码
 * @param params params
 */
export const resetUserP = params => fetch(`${base}/v1/banker/records/users?${urlEncode(params.query).substr(1)}`, {
    method: 'PATCH',
    // credentials: '*',
    body: JSON.stringify(params.data),
    headers: {
        Authorization:sessionStorage.token
    }
});

/**
 * 在线人数
 * @param params params
 */
export const getOnlinecount = params => fetch(`${base}/v1/manager/onlinecount`, {
    method: 'GET',
    //credentials: '*',
    body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 在线检测
 * @param params params
 */
export const getOnline = params => fetch(`${base}/v1/banker/online/${params}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 获取当前用户的返点表
 * @param params params
 */
export const getOwn = params => fetch(`${base}/v1/banker/rebate/own?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 设定用户的返点表
 * @param params params
 */
export const setRebate = params => fetch(`${base}/v1/banker/rebate/set`, {
    method: 'POST', 
    //credentials: '*', 
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 获取当前用户的代理树
 * @param params params
 */
export const getNodeList = params => fetch(`${base}/v1/banker/node_list`, {
    method: 'GET',
    //credentials: '*',
    body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 获取一个用户
 * @param params params
 */
export const getUser = params => fetch(`${base}/v1/banker/user/${params.level_id}/${params.user_name}`, {
    method: 'GET',
    //credentials: '*',
    body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 新增一个用户
 * @param params params
 */
export const addUser = params => fetch(`${base}/v1/banker/user/${params.level_id}/${params.user_name}`, {
    method: 'POST',
    //credentials: '*',
    body: JSON.stringify(params.body),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 修改一个用户
 * @param params params
 */
export const setUser = params => fetch(`${base}/v1/banker/user/${params.level_id}/${params.user_name}`, {
    method: 'PUT',
    //credentials: '*',
    body: params.data,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 获取系统配置
 * @param params params
 */
export const getOpenSysconf = params => fetch(`${base}/v1/open/sysconf`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 获取系统配置
 * @param params params
 */
export const getSysconf = params => fetch(`${base}/v1/manager/sysconf`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 修改系统配置
 * @param params params
 */
export const setSysconf = params => fetch(`${base}/v1/manager/sysconf`, {
    method: 'PUT',
    //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 获取上级关系
 * @param params params
 */
export const getRef = params => fetch(`${base}/v1/banker/records/users/ref_card?up_string=${params}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * T人
 * @param params params
 */
export const kick = params => fetch(`${base}/v1/banker/kick/${params}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 彩种信息
 * @param params params
 */
export const getGameInfo = params => fetch(`${base}/v1/open/gameInfo`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 修改银行信息
 * @param params params
 */
export const setBankInfo = params => fetch(`${base}/v1/open/user/bank`, {
    method: 'PUT',
    //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 新增银行信息
 * @param params params
 */
export const addBankInfo = params => fetch(`${base}/v1/open/user/bank`, {
    method: 'POST',
    //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 获取充值申请列表
 * @param params params
 */
export const getRecharge = params => fetch(`${base}/v1/open/recharge?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 充值申请
 * @param params params
 */
export const recharge = params => fetch(`${base}/v1/open/recharge`, {
    method: 'POST',
    //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 处理充值申请
 * @param params params
 */
export const setRecharge = params => fetch(`${base}/v1/open/recharge`, {
    method: 'PATCH',
    // //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        Authorization:sessionStorage.token
    }
});


/**
 * 获取提现申请列表
 * @param params params
 */
export const getWithdraw = params => fetch(`${base}/v1/open/withdraw?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 提现申请
 * @param params params
 */
export const withdraw = params => fetch(`${base}/v1/open/withdraw`, {
    method: 'POST',
    //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 处理提现申请
 * @param params params
 */
export const setWithdraw = params => fetch(`${base}/v1/open/withdraw`, {
    method: 'PATCH',
    // credentials: '*',
    body: JSON.stringify(params),
    headers: {
        Authorization:sessionStorage.token
    }
});

/**
 * 账户概览
 * @param params params
 */
export const getUserInfo = params => fetch(`${base}/v1/banker/account/info`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 个人中心:资金变动
 * @param params params
 */
export const getAccountChange = params => fetch(`${base}/v1/banker/account_change?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 个人中心:个人账户盈亏
 * @param params params
 */
export const getEarn = params => fetch(`${base}/v1/banker/center/earn?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 用户对账
 * @param params params
 */
export const getCheck = params => fetch(`${base}/v1/banker/account/check?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 用户对账清零
 * @param params params
 */
export const setCheck = params => fetch(`${base}/v1/banker/account/check?${urlEncode(params.query).substr(1)}`, {
    method: 'PATCH',
    //credentials: '*',
    body: JSON.stringify(params.data),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 获取帮助信息列表
 * @param params params
 */
export const getHelp = params => fetch(`${base}/v1/manager/app/help`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 添加帮助信息
 * @param params params
 */
export const addHelp = params => fetch(`${base}/v1/manager/app/help`, {
    method: 'POST',
    //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 修改帮助信息
 * @param params params
 */
export const setHelp = params => fetch(`${base}/v1/manager/app/help`, {
    method: 'PUT',
    //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 删除帮助信息
 * @param params params
 */
export const delHelp = params => fetch(`${base}/v1/manager/app/help?${urlEncode(params.query).substr(1)}`, {
    method: 'DELETE',
    //credentials: '*',
    body: JSON.stringify(params.data),
    headers: {
        'Authorization':sessionStorage.token
    }
});




/**
 * 获取公告列表
 * @param params params
 */
export const getNotice = params => fetch(`${base}/v1/manager/app/notice?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 添加公告
 * @param params params
 */
export const addNotice = params => fetch(`${base}/v1/manager/app/notice`, {
    method: 'POST',
    //credentials: '*',
    headers: {
        'Content-Type': 'multipart/form-data'
    },
    body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 修改公告
 * @param params params
 */
export const setNotice = params => fetch(`${base}/v1/manager/app/notice`, {
    method: 'PUT',
    //credentials: '*',
    headers: {
        'Content-Type': 'multipart/form-data'
    },
    body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 删除公告
 * @param params params
 */
export const delNotice = params => fetch(`${base}/v1/manager/app/notice?${urlEncode(params).substr(1)}`, {
    method: 'DELETE',
    //credentials: '*',
    // body: JSON.stringify(params.data),
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 极光推送
 * @param params params
 */
export const addjgTxt = params => fetch(`${base}/v1/manager/jpush`, {
    method: 'POST',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 系统设置:彩种规则说明
 * @param params params
 */
export const getGameCodex = params => fetch(`${base}/v1/manager/app/game_info`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 系统设置:彩种规则说明
 * @param params params
 */
export const setGameCodex = params => fetch(`${base}/v1/manager/app/game_info`, {
    method: 'PUT',
    //credentials: '*',
    headers: {
        'Content-Type': 'multipart/form-data'
    },
    body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 系统设置:彩种规则说明
 * @param params params
 */
export const addGameCodex = params => fetch(`${base}/v1/manager/app/game_info`, {
    method: 'POST',
    //credentials: '*',
    headers: {
        'Content-Type': 'multipart/form-data'
    },
    body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 添加六合彩
 * @param params params
 */
export const addHk6 = params => fetch(`${base}/v1/manager/hk6/open_info`, {
    method: 'POST',
    //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 获取轮播列表
 * @param params params
 */
export const getSlides = params => fetch(`${base}/v1/manager/app/slides`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 添加轮播图片
 * @param params params
 */
export const addSlides = params => fetch(`${base}/v1/manager/app/slides`, {
    method: 'POST',
    //credentials: '*',
    body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 修改轮播图片
 * @param params params
 */
export const setSlides = params => fetch(`${base}/v1/manager/app/slides`, {
    method: 'PUT',
    //credentials: '*',
    body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 删除轮播图片
 * @param params params
 */
export const delSlides = params => fetch(`${base}/v1/manager/app/slides?${urlEncode(params).substr(1)}`, {
    method: 'DELETE',
    //credentials: '*',
    // body: JSON.stringify(params.data),
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 用户还款
 * @param params params
 */
export const getPaid = params => fetch(`${base}/v1/banker/account/paid?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 用户对账清零
 * @param params params
 */
export const setPaid = params => fetch(`${base}/v1/banker/account/paid?${urlEncode(params.query).substr(1)}`, {
    method: 'POST',
    //credentials: '*',
    body: JSON.stringify(params.data),
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 时时注单
 * @param params params
 */
export const getOrder = params => fetch(`${base}/v1/banker/order/list?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 时时注单撤单
 * @param params params
 */
export const setOrder = params => fetch(`${base}/v1/banker/order/list?${urlEncode(params.query).substr(1)}`, {
    method: 'PATCH',
    //credentials: '*',
    body: JSON.stringify(params.data),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 投注报表
 * @param params params
 */
export const getStatement = params => fetch(`${base}/v1/banker/statement/order?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 财务报表
 * @param params params
 */
export const getFinance = params => fetch(`${base}/v1/banker/finance_report?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 团队报表
 * @param params params
 */
export const getTeam = params => fetch(`${base}/v1/banker/team_report?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 用户登陆记录
 * @param params params
 */
export const getUserLoginList = params => fetch(`${base}/v1/banker/user_login_list?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 用户银行信息
 * @param params params
 */
export const getUserBankInfo = params => fetch(`${base}/v1/banker/user_bank_info?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 用户银行信息
 * @param params params
 */
export const setUserBankInfo = params => fetch(`${base}/v1/banker/user_bank_info?${urlEncode(params.query).substr(1)}`, {
    method: 'PUT',
    //credentials: '*',
    body: JSON.stringify(params.data),
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 帐变类型
 * @param params params
 */
export const getAccountChangeTypes = params => fetch(`${base}/v1/open/account_change_types`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 彩种管理
 * @param params params
 */
export const getGameLotteries = params => fetch(`${base}/v1/manager/game_lotteries`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 赔率设置
 * @param params params
 */
export const getOdds = params => fetch(`${base}/v1/manager/odds?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 赔率设置
 * @param params params
 */
export const setOdds = params => fetch(`${base}/v1/manager/odds?${urlEncode(params.query).substr(1)}`, {
    method: 'PUT',
    //credentials: '*',
    body: JSON.stringify(params.data),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 清除赔率设置缓存
 * @param params params
 */
export const reOdds = params => fetch(`${base}/v1/manager/odds`, {
    method: 'PATCH',
    //credentials: '*',
    // body: JSON.stringify(),
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 预设管理
 * @param params params
 */
export const getTmpData = params => fetch(`${base}/v1/manager/tmp_data?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 预设管理
 * @param params params
 */
export const setTmpData = params => fetch(`${base}/v1/manager/tmp_data?${urlEncode(params.query).substr(1)}`, {
    method: 'PATCH',
    //credentials: '*',
    body: JSON.stringify(params.data),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 开奖检测
 * @param params params
 */
export const getOpenDetection = params => fetch(`${base}/v1/manager/open_detection`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 开奖检测
 * @param params params
 */
export const setOpenDetection = params => fetch(`${base}/v1/manager/open_detection`, {
    method: 'PUT',
    //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 开奖数据
 * @param params params
 */
export const getGamekjData = params => fetch(`${base}/v1/manager/game_kj_data?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    //credentials: '*',
    // body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});


/**
 * 彩种管理
 * @param params params
 */
export const setGameLotteries = params => fetch(`${base}/v1/manager/game_lotteries`, {
    method: 'PUT',
    //credentials: '*',
    body: JSON.stringify(params),
    headers: {
        'Authorization':sessionStorage.token
    }
});



/**
 * 资金操作
 * @param params params
 */
export const getAction = params => fetch(`${base}/v1/banker/account/action?${urlEncode(params).substr(1)}`, {
    method: 'GET',
    // credentials: '*',
    // body: params,
    headers: {
        Authorization:sessionStorage.token
    }
});

/**
 * 资金操作
 * @param params params
 */
export const setAction = params => fetch(`${base}/v1/banker/account/action?${urlEncode(params.query).substr(1)}`, {
    method: 'PUT',
    //credentials: '*',
    body: JSON.stringify(params.data),
    headers: {
        'Authorization':sessionStorage.token
    }
});

/**
 * 站点Logo上传
 * @param params params
 */
export const addLogo = params => fetch(`${base}/v1/manager/site_logo`, {
    method: 'POST',
    //credentials: '*',
    body: params,
    headers: {
        'Authorization':sessionStorage.token
    }
});